# keep these in-synch with the #defines in crash_handler.c
VERSION=0
REVISION=5

PROG = crash_handler

OBJECTS = crash_handler.o \
	utility.o \
	journal.o \
	table-pr-support.o \
	table-unwind-arm.o \
	guess-unwinder.o

$(PROG): $(OBJECTS)
	$(CROSS_COMPILE)gcc $^ -o $@

%.o: %.c
	$(CROSS_COMPILE)gcc -c $< -o $@

clean:
	rm $(PROG) $(OBJECTS)

# select the installation method by uncommenting one of these:
#install: default_install
install: sony_install

default_install:
	# this won't work unless you are self-hosted on ARM
	cp $(PROG) /tmp
	/tmp/$(PROG) --install
	 
sony_install:
	ttc cp $(PROG) target:/tmp
	ttc run "/tmp/$(PROG) --install"

distribution:
	make clean
	cd .. ; ln -s crash_handler crash_handler-${VERSION}.${REVISION} ; \
	tar -czvf crash_handler-${VERSION}.${REVISION}.tgz crash_handler-${VERSION}.${REVISION}/* ; \
	unlink crash_handler-${VERSION}.${REVISION}
	
	 
